#### README for "Who votes more strategically?" ####


### Code ###

The code is broken up into several files.

## Data preparation ##
(1) wvms_bes_data_prep_all.r: inputs raw files from the BES, recodes as necessary, outputs BES_2005_2010_2015_combined.csv
(2) wvms_code_for_processing_combined_data.r: takes the output of (1), computes variables necessary for analysis including tau and best insincere vote (and this takes a long time, because we have to compute pivot probabilities for each constituency in each election for different values of s, different measures of preference, and different sources of beliefs), outputs BES_all_including_all_taus_2005_2010_2015.csv

## Data analysis ##
(3) wvms_dirichlet_calibration.r: takes actual results and forecasts (all_results_05_10_15.csv) and computes s parameter that maximizes likelihood of actual results when forecast results are expected and vice versa
(4) wvms_code_for_strategic_response_functions_and_descriptives.r: takes output of (2), outputs strategic responsiveness figures for paper (i.e. figures that plot best insincere voting as function of tau). By default, figures output to "./output/" directory.
(5) wvms_code_for_regressions.R: takes output of (2), runs regressions and outputs coefficient plots for paper (i.e. figures that plot differences in strategic responsiveness by voter type) and tables for paper (raw SR by voter type). Also produces numerous analysis reported in online appendices B and C.

## Illustrations ##
(6) wvms_code_for_illustrations.R: Produces illustrations in paper. By default, figures output to "./output/" directory.

## Utilities ##
(7) utils_party_regularizing.r: function for taking strings used to describe parties in BES and converts them to standardized codes
(8) utils_pivotality_functions.R: functions for computing pivot probabilities via numerical integration given independence assumption
(9) utils_plotting_functions.R: function for making the "strategic responsiveness function" plots.


### Datasets ###

-- all_results_05_10_15.csv: forecasts, results, and previous results for UK constituencies in 2005, 2010, and 2015 elections. (We assembled this from BES and electionforecast.co.uk files.)
-- raw BES files, downloaded from the BES website:
  -- 2005BESinternet.DTA
  -- cipsdec2311.dta
  -- BES-2015-General-Election-results-file-v2.0_old.dta
  -- BES-2015-General-Election-results-file-v2.21.sav
  -- BES2015_W2_Panel_v2.0_1.sav
  -- BES2015_W6_Panel_v1.2.sav
  -- bes_f2f_2015_v4.0.sav
